<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<style type="text/css">
	div{width:200px;height:200px;background:red;margin-bottom: 50px;}
	p{width:200px;height:200px;background:green;}
</style>
<script type="text/javascript">
window.onload = function (){
	var aDiv = document.getElementsByTagName('div');
/*
	for (var i = 0; i < aDiv.length; i++) {

		aDiv[i].index = i;
		aDiv[i].onmouseover = function (){
		setTimeout(function(){

			//this.style.display = 'none';					//在定时器内部，不能不指定直接使用this,

			//aDiv[this.index].style.display = 'none';		//在定时器内部，不能【直接单独】用aDiv[this.index],
		
			//for (var i = 0; i < aDiv.length; i++) {aDiv[i].style.display = 'none';};		//在定时器内部，也不能直接用aDiv[i]。

		},2000)
	}
*/
	//一句话，定时器的东西好像没办法动态，需要提前指向【补充，定时器的this指向window】
	

	//正确的打开方式：
	for (var i = 0; i < aDiv.length; i++) {
		aDiv[i].index = i;						//索引
		aDiv[i].onmouseover = function (){
			var that = this;					//先指向在设置定时器 或者 n = this.index,定时就用aDiv[n]
			setTimeout(function (){
				that.style.display = 'none';
			},200);
		};
	}
}
</script>
<body>
	<div></div>
	<div></div>
	<p></p>
</body>
</html>